<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="http://lib.sinaapp.com/js/jquery/1.7.2/jquery.min.js"></script>
</head>
<body>
<H1>支付测试</H1>
<hr>
<div class="form-container">
    <form id="form" >
        <!--   *商户订单 :-->
        *订单名称 :
        <input type="text" name="subject" id="subject" value="快乐风男套餐"><br>
        *付款金额 :
        <input type="text" name="total_amount" id="total_amount" value="30" ><br>
        *商品描述 :
        <input type="text" name="body" id="body" value="快乐风男套餐30元"><br>

    </form>
    <p id="form1"></p>
    <input type="submit" value="支付宝支付" onclick="pay()">
</div>
<H1>查询订单</H1>
<hr>
<div class="form-container">
    <form id="queryForm" >
        <!--   *商户订单 :-->
        *订单编号 :
        <input type="text" name="out_trade_no" id="out_trade_no" value=""><br>

    </form>
    <input type="submit" value="查询订单信息" onclick="query()">
</div>

<H1> <a href="/unionPay">银联支付</a></H1>
<hr>
</body>

<script type="text/javascript">

    $(document).ready(function(){
        $("#out_trade_no").val('')
    })


   function pay()  {
       var para = {}
       para.subject = $("#subject").val()
       para.total_amount = $("#total_amount").val()
       para.body = $("#body").val()
       $.ajax({
           "type":"post",
           "url":"http://127.0.0.1:8889/alipay/testpay",
           "data":JSON.stringify(para),
           "contentType": "application/json",
           success:function (res) {
               $("#form").remove()
               $("#form1").append(res)
               console.log(res)
           }
       })
   }

   function query()  {
       $.ajax({
           "type":"get",
           "url":"http://127.0.0.1:8889/alipay/queryOredr?out_trade_no=" + $("#out_trade_no").val(),
           success:function (res) {
               console.log(res)
           }
       })
   }

</script>
<style>
    .form-container {
        padding-top:10px;
    }
    input {
        margin:10px;

    }
</style>
</html>

